<%--

<!------------------------------------------------------------------------------
 - Copyright 2006 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   USER
 - AUTHOR           :   Victor Zheng 
 - DATE CREATE      :   2006/02/01
 - DESCRIPTION      :   a COMMON TAB JSP file for the function, USER
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2006/02/01   Victor Zheng    1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.admin.userSetup.vo.UserVo"%>
<%@ page import="com.erp.app.admin.userSetup.web.UserMaintenanceAction"%>
<%@ page import="com.erp.app.admin.userSetup.web.UserMaintenanceForm"%>
<%@ page import="com.erp.framework.util.user.User"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="userMaintenanceForm" scope="session" type="com.erp.app.admin.userSetup.web.UserMaintenanceForm" />

<!-- MUST use the following example to mark fields as mandatory field inputs-->
<!--
<td class="grid_header" nowrap><span class="mandatory_label">
<bean:message key="label.general.mandatory.field"/>
...</span></td>
-->
<%
formReadOnly = false;
TableSchema ts = userMaintenanceForm.getTs();
User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);
%>
<table class="table_common">

	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="userCode"/>
		</td>
		<td class="col_value" nowrap>
			<logic:equal name="userMaintenanceForm" property="pageMode" value="<%=userMaintenanceForm.PAGE_MODE_CREATE%>">
				<html:text property="userCode" styleClass="textbox1" readonly="<%=formReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(userMaintenanceForm.getUserCode())%>"/>
			</logic:equal>
			<logic:notEqual name="userMaintenanceForm" property="pageMode" value="<%=userMaintenanceForm.PAGE_MODE_CREATE%>">
				<bean:write name="userMaintenanceForm" property="userCode" filter="true"/>
			</logic:notEqual>
		</td>
		<%
		colSize = String.valueOf(ts.getColSizeByObjectId("LBL_USER_USER_NAME"));
		displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_USER_USER_NAME"));
		%>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="userName"/>
		</td>
		<td class="col_value" nowrap>
			<html:text property="userName" styleClass="textbox1" readonly="<%=formReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(userMaintenanceForm.getUserName())%>"/>
		</td>
	</tr>
	<tr>
		<%
		colSize = String.valueOf(ts.getColSizeByObjectId("LBL_USER_PASSWORD"));
		displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_USER_PASSWORD"));
		%>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="password"/>
		</td>
		<td class="col_value" nowrap>
			<html:password property="password" styleClass="textbox1" readonly="<%=formReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(userMaintenanceForm.getPassword())%>"/>
		</td>
		<%
		colSize = String.valueOf(ts.getColSizeByObjectId("LBL_USER_EMAIL"));
		displaySize = String.valueOf(ts.getDisplaySizeByObjectId("LBL_USER_EMAIL"));
		%>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="email"/>
		</td>
		<td class="col_value" nowrap>
			<html:text property="email" styleClass="textbox1" readonly="<%=formReadOnly%>" maxlength="<%=colSize%>" size="<%=displaySize%>" value="<%=CommonUtil.nullToString(userMaintenanceForm.getEmail())%>"/>
		</td>
	</tr>	
	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="dept"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="userMaintenanceForm" property="dept" showCode="false"/>
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="roleGroupId"/>
		</td>
		<td class="col_value" nowrap>
			<select name="roleGroupId" <%=formReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">
			<%	where = "COMPANY_CODE = '" + WebUtil.getAppropriateCompanyCode(session, ProjectConstants.SP_SHARE_ROLE_GROUP) + "'";%>
				<option value=""></option>
				<chtml:options table="T_ROLE_GROUP"
							valuecolumn="ROLE_GROUP_ID"
							textcolumn="DESCRIPTION"
							where="<%=where%>"
							order="ROLE_GROUP_ID"
							selected="<%= userMaintenanceForm.getRoleGroupId() %>" />
			</select>
		</td>
	</tr>	
	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="userGroupCode"/>
		</td>
		<td class="col_value" nowrap>			
			<select name="userGroupCode" <%=formReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">
			<%	where = "COMPANY_CODE ='" + WebUtil.getAppropriateCompanyCode(session, ProjectConstants.SP_SHARE_ACCESS_RIGHT) + "'"; %>
				<option value="">
				<chtml:options table="T_ACCESS_RIGHT_HDR"
						valuecolumn="USER_GROUP_CODE"
						textcolumn="USER_GROUP_DESC"
						where= "<%=where%>"
						order="USER_GROUP_DESC"
						selected="<%=userMaintenanceForm.getUserGroupCode()%>" />
			</select>	
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="groupLevel"/>
		</td>
		<td class="col_value" nowrap>
			<select name="groupLevel" class="t2">
					<%
						String grpLvl = "";
						if ((userMaintenanceForm.getGroupLevel())!= null)
							grpLvl = userMaintenanceForm.getGroupLevel();
					%>
					<option value=""></option>
					<option value="1" <%= grpLvl.equals("1") ? "selected" : "" %>>1</option>
					<option value="2" <%= grpLvl.equals("2") ? "selected" : "" %>>2</option>
					<option value="3" <%= grpLvl.equals("3") ? "selected" : "" %>>3</option>
					<option value="4" <%= grpLvl.equals("4") ? "selected" : "" %>>4</option>
					<option value="5" <%= grpLvl.equals("5") ? "selected" : "" %>>5</option>
					<option value="6" <%= grpLvl.equals("6") ? "selected" : "" %>>6</option>
					<option value="7" <%= grpLvl.equals("7") ? "selected" : "" %>>7</option>
					<option value="8" <%= grpLvl.equals("8") ? "selected" : "" %>>8</option>
					<option value="9" <%= grpLvl.equals("9") ? "selected" : "" %>>9</option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="signature"/>
		</td>
		<td class="col_value" nowrap>
		<% if(userMaintenanceForm.getSignature() == null) { %>
			<chtml:button form="userMaintenanceForm" pageEvent="<%=UserMaintenanceAction.ACTION_ADD_ATTACH%>"
			styleClass="button1"/>
		<% } else { %>
			<%--
			<chtml:button form="userMaintenanceForm" pageEvent="<%=UserMaintenanceAction.ACTION_VIEW_ATTACH%>"
			styleClass="button1"/>
			--%>
			<input type="button" value="View" class="button1" onClick="javascript:doViewImage('<%=UserMaintenanceAction.ACTION_VIEW_ATTACH%>');">
			<chtml:button form="userMaintenanceForm" pageEvent="<%=UserMaintenanceAction.ACTION_DEL_ATTACH%>"
			styleClass="button1"/>
		<% } %>
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="activation"/>
		</td>
		<td class="col_value" nowrap>
			<select name="activation" <%=rowReadOnly ? "disabled=\"true\"" : ""%> class="selectBox1">			
			    <%where = " TYPE = '" +  ProjectConstants.CONSTANT_TYPE_ACT_INACT + "' ";%>
				<option value="">
				<chtml:options table="T_SYS_CONSTANTS"
				valuecolumn="CONSTANT_CODE"
				textcolumn="CONSTANT_NAME"
				where= "<%=where%>"
				order="CONSTANT_NAME"
				selected="<%=userMaintenanceForm.getActivation()%>"
			/>
	        </select>
		</td>
	</tr>

	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="qaHandlerFlag"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" showCode="false" name="userMaintenanceForm" property="qaHandlerFlag" readonly="<%=rowReadOnly%>" />
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="qcHandlerFlag"/>		
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" showCode="false" name="userMaintenanceForm" property="qcHandlerFlag" readonly="<%=rowReadOnly%>" />		
		</td>
	</tr>

	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="approverFlag"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" showCode="false" name="userMaintenanceForm" property="approverFlag" readonly="<%=rowReadOnly%>" />
		</td>
		<td class="col_label">
			&nbsp;
		</td>
		<td class="col_value" nowrap>
			&nbsp;
		</td>
	</tr>
	<tr>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="userDivision"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox"  showCode="false" name="userMaintenanceForm" property="userDivision" readonly="<%=rowReadOnly%>" />
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="hdrCompanyType"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="userMaintenanceForm" property="hdrCompanyType" readonly="<%=formReadOnly%>" showDescription="true" showCode="false" />
		</td>
	</tr>		
	<tr>
	  <td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="hdrNtTeam"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="userMaintenanceForm" property="hdrNtTeam" styleClass="textbox1" readonly="<%=formReadOnly%>" showDescription="true" showCode="false" />
		</td>
		<td class="col_label">
			<html:text useExtensions="true" uiType="label" name="userMaintenanceForm" property="hdrCustCode"/>
		</td>
		<td class="col_value" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="userMaintenanceForm" property="hdrCustCode" styleClass="textbox1" readonly="<%=formReadOnly%>" showDescription="true" showCode="false"  />
		</td>

	</tr>
</table>

